package com.ruoyi.web.controller.agv;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.order.domain.MesDetectNode;
import com.ruoyi.web.controller.agv.req.BindNotifyReq;
import com.ruoyi.web.controller.agv.req.WarnCallbackReq;
import com.ruoyi.web.controller.agv.res.BaseRes;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/agv/agvCallbackService")
public class AgvCallbackController {

    /**
     * 告警推送回调的方法，调度系统将导致AGV停止运行的严重告警推送给上层系统。
     * 推送频率：10秒一次
     * @return
     */
    @PostMapping("/warnCallback")
    public String warnCallback(@RequestBody WarnCallbackReq warnCallbackReq) {
        BaseRes baseRes = new BaseRes();
        //@todo 处理业务逻辑
        baseRes.setReqCode(warnCallbackReq.getReqCode());
        baseRes.setCode("0");
        baseRes.setMessage("成功");
        return JSON.toJSONString(baseRes);
    }


    @PostMapping("/bindNotify")
    public String bindNotify(@RequestBody BindNotifyReq bindNotifyReq) {
        //@todo 处理业务逻辑

        BaseRes baseRes = new BaseRes();
        baseRes.setReqCode(bindNotifyReq.getReqCode());
        baseRes.setCode("0");
        baseRes.setMessage("成功");
        return JSON.toJSONString(baseRes);
    }
}
